chdkfandomcom-20200222-history
Prepare your SD card
How to prepare the SD card for booting the DISKBOOT.BIN file After compiling the g7_blinker for the proper LED address you want, do the following with your SD card: * Format the card to FAT16 with a desktop computer via a USB card reader and create the DCIM and MISC folders on the newly formatted card. Alternatively, you can format your card with the camera. After this, Windows: Case #1 * Download the HDHacker utility to execute the following steps. * Install and run the HDHacker. * Select the proper drive letter corresponding to your SD card in the card reader. * Select "logical drive" and "first sector" (as far as I know, it's the default) * "Read sector from disk" * Save this sector to a file for safety (512 bytes) (I named it: BootSector_G9.bin) * Use a hex editor to edit this file * Go to offset 0x40 (decimal 64) and type BOOTDISK in ASCII mode (as explained here). Keep in mind that, if you do not see FAT12 or FAT16 around 0x36 (decimal 54) in the hex editor, you probably picked the wrong drive. Do not overwrite anything in that case. * Save it as a different file (I named it: BootSector_G9_bootable.bin) * Use HDHacker to "load sector from file" this new file containing BOOTDISK information onto your SD card * "write sector on disk" Don't forget to select the correct drive letter! Windows: Case #2 * Extract from above bootable.zip the "bootable.exe" file * Put your SD card into reader or SD slot in computer and copy "bootable.exe" to the SD card * SD card behaves as disk and has assigned some letter (for example "F:"). Run shell (on winXP: menu Start - Run..., type "cmd") and change to SD card (by typing "F:" and press Enter in this example case) * Run "bootable.exe" You will be prompt to give right syntax as "bootable.exe F:" * Confirm and your SD card is bootable (Note: Doesn´t work with SanDisk Ultras "USB-Edition"!) Windows: Case #3 Use this small GUI Utility created by whim THX Latest version here More info here Linux: * Start a terminal, if you haven't done so already * Determine the location of your card, it is usually something like /dev/sd'x'. If the card is mounted, you can determine the location from the mount command. Make sure you pick the right one! Replace the x''' in /dev/sd'''x appropriately. * Make sure your card is unmounted (umount /dev/sd'x'''1) * Now, you need to alter the partition's bootsector. There are two ways to do this. This guide assumes hexedit is used, though you can use any hex editor. Keep in mind that, if you do not see FAT12 or FAT16 around 0x36 (decimal 54) in the hex editor, you probably picked the wrong drive. Do not overwrite anything in that case. *# Directly *#* Open your SD card's FAT partition in hexedit: hexedit /dev/sd'x'1 *#* Go to offset 0x40 (decimal 64) and type BOOTDISK in ASCII mode. *#* Save (Ctrl-X in hexedit) and quit. *# Indirectly *#* First, extract the bootsector like this: dd if=/dev/sd'x'1 of=BootSector_G9.bin bs=512 count=1 *#* Copy the saved file, so you have a backup: cp BootSector_G9{,_bootable}.bin *#* Open the copy in a hex editor: hexedit BootSector_G9_bootable.bin *#* Go to offset 0x40 (decimal 64) and type BOOTDISK in ASCII mode. *#* Save (Ctrl-X in hexedit) and quit. *#* Upload the bootsector to the card again: dd if=BootSector_G9_bootable.bin of=/dev/sd'x'1 bs=512 count=1 '''Mac' *#''The instructions for the direct method for Linux also work for mac, provided you have darwin ports installed'' *#* Go to Darwin Ports website and install Darwin Ports http://darwinports.com/ *#* type sudo port install hexedit to install hexedit *#* type man hexedit to familiarize yourself with the commands of hexedit *#* Open Disk Utility and click on the image for the SD card - click on "Get Info" to determine the location of the partition (such as disk4s1) *#* Use Disk Utility to unmount the partition *#* in a terminal window, type sudo hexedit disk4s1. Press enter. Type in '40' to go to offset 0x40. Hit "tab" to switch to typing on the ASCII side. Type "BOOTDISK". Hit control-X and say "yes" when prompted to save. *#''If you don't want to install darwinports and hexedit, you can also get the free 0xED http://www.suavetech.com/0xed/0xed.html, which will work with the indirect way as well.'' *#* Go to the Disk Utility. Select your SD card from the list at the left, and click Informations to get the disk identifier (example: disk4s1). *#* Unmount (don't eject) your SD card. *#* Open a Terminal window and type: dd if=/dev/'disk4s1' of=BootSector_G9.bin bs=512 count=1 *#* The BootSector_G9.bin file in your Home directory contains your SD card's boot sector. Make a backup of it in case anything goes wrong. *#* Open BootSector_G9.bin with 0xED. Keep in mind that, if you do not see FAT12 or FAT16 around 0x36 (decimal 54) in the hex editor, you probably picked the wrong drive. Do not overwrite anything in that case. Otherwise, select the Overwrite writing method (Command+Shift+O). Go at offset 0x40 (decimal 64) and press Tab. Type BOOTDISK. Save and quit. *#* In your Terminal window, type: dd if=BootSector_G9.bin of=/dev/'disk4s1' bs=512 count=1 Now you have a Bootable SD card. The camera will now attempt to load the DISKBOOT.BIN file whenever the camera is started with that SD card (when it's locked). Now, all you need to do is copy the file DISKBOOT.BIN to the SD card. Further instructions for blinking the firmware: * Power off the G9. (Disconnect it from the PC if it was connected before) * Take out the SD card. * SET THE SD CARD LOCK! (THIS IS VERY IMPORTANT) Now it should be read-only. * Insert the SD card again. * Turn on the G9. After a few seconds, the AF (or other) led turns on, at least it looks like it. It is actually blinking, but too fast for the human eye to register. How to stop the blinking? * You have to remove the battery to stop the blinking. * To use your SD card as before: simply clear the SD LOCK, so it is set back to read/write enabled. http://chdk.wikia.com/wiki/G9 Back to the G9 page